package bean;

import java.util.HashMap;
import java.util.Map;

public class TranslatorBean {
    private String chineseWord;
    private String englishWord;
    private Map<String, String> data;

    public TranslatorBean() {
        init();
    }

    private void init() {
        data = new HashMap<String, String>();
        data.put("姓名", "name");
        data.put("性别", "sex");
        data.put("年龄", "age");

        data.put("看书", "reading");
        data.put("跳舞", "dancing");
        data.put("唱歌", "singing");
        data.put("游泳", "swimming");
        data.put("足球", "playing football");

        data.put("爱好", "favourite");
    }

    public String getChineseWord() {
        return chineseWord;
    }

    public void setChineseWord(String chineseWord) {
        this.chineseWord = chineseWord;
    }

    public String getEnglishWord() {
        String translation = (String) data.get(this.chineseWord);
        if (translation != null && !translation.equals("")){
            this.englishWord = translation;
        }else{
            this.englishWord = chineseWord + "的英文";
        }
        return englishWord;
    }

    public void setEnglishWord(String englishWord) {
        this.englishWord = englishWord;
    }

    public Map<String,String> getData() {
        return data;
    }

    public void setData(Map<String, String> data) {
        this.data = data;
    }

}